package com.zhyt.intelligentpipeline.model;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum GradePressure {

    L450("L450",533.0),
    X650("X650",533.0),
    L415("L415",520.0),
    X60("X60",520.0),
    L360("L360",460.0),
    X52("X52",460.0),
    L245("L245",415.0);
    private final String grade;

    private final Double pressure;

    public static Double getPressureByGrade(String grade){
        String gradeValue = grade.replace("MB", "").replace("M","");
        if(gradeValue.equalsIgnoreCase(L450.grade)){
            return L450.getPressure();
        }else if(gradeValue.equalsIgnoreCase(X650.grade)){
            return X650.getPressure();
        }else if(gradeValue.equalsIgnoreCase(L415.grade)){
            return L415.getPressure();
        }else if(gradeValue.equalsIgnoreCase(X60.grade)){
            return X60.getPressure();
        }else if(gradeValue.equalsIgnoreCase(L360.grade)){
            return L360.getPressure();
        }else if(gradeValue.equalsIgnoreCase(X52.grade)){
            return X52.getPressure();
        }else if(gradeValue.equalsIgnoreCase(L245.grade)){
            return L245.getPressure();
        }else{
            return L450.getPressure();
        }
    }




}
